package com.wxx.design.flyweight;

import java.util.Random;

/**
 * @author Jetwang
 * @version 1.0
 * @date 2022/4/20 20:38
 */
public class Test {
    public static final String[] departments = {"RD", "QA", "PM", "BD"};

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            String department = departments[new Random().nextInt(departments.length)];
            Manager manager = (Manager) EmployeeFactory.getManager(department);
            manager.report();;
        }



        /**
         *  static final int low = -128;
         *  static final int high; 127
         *  public static Integer valueOf(int i) {
         *         if (i >= IntegerCache.low && i <= IntegerCache.high)
         *             return IntegerCache.cache[i + (-IntegerCache.low)];
         *         return new Integer(i);
         *     }
         */
        Integer a = Integer.valueOf(100);
        Integer b = 100;
        System.out.println(a == b);

        Integer c = Integer.valueOf(127);
        Integer d = 127;
        System.out.println(c == d);
    }
}
